/***********************************************************************************
**  
* @copyright (c) 2010-2019, ChengDu Duyer Technology Co., LTD. All Right Reserved.
*
************************************************************************************/
/**
* @file	    mjs_mysql_result.cpp
* @version     
* @brief      
* @author   duye
* @date	    2016-12-27
* @note 
*
* 1. 2016-12-27 duye Created this file
*/

#include <mjs_mysql_result.h>

MJSMysqlRow::MJSMysqlRow() {}
MJSMysqlRow::~MJSMysqlRow() {}

void MJSMysqlRow::addPara(const std::string& title, const std::string& value) {
	m_row_data_map.insert(std::make_pair(title, value));
}

std::string MJSMysqlRow::getValue(const std::string& title) {
	MJSRowDataMap::iterator iter = m_row_data_map.find(title);
	if (iter == m_row_data_map.end()) {
		return "";
	}

	return iter->second;
}

const MJSMysqlRow::MJSRowDataMap& MJSMysqlRow::getRowDataMap() const {
	return m_row_data_map;
}

MJSMysqlResult::MJSMysqlResult() : m_affected(0) {}
MJSMysqlResult::~MJSMysqlResult() {}

uint32 MJSMysqlResult::row() {
	return m_table.size();
}

uint32 MJSMysqlResult::row() const {
	return m_table.size();
}

void MJSMysqlResult::setAffected(const uint32& row) {
	m_affected = row;
}

uint32 MJSMysqlResult::affected() {
	return m_affected;
}

uint32 MJSMysqlResult::affected() const {
	return m_affected;
}

bool MJSMysqlResult::empty() {
	return m_table.empty();
}

bool MJSMysqlResult::empty() const {
	return m_table.empty();
}

void MJSMysqlResult::insertRow(const MJSMysqlRow& row) {
	m_table.push_back(row);
}

const MJSResultTable& MJSMysqlResult::getTable() const {
	return m_table;
}